package com.badlogic.gdx.scenes.scene2d.ui;

import java.util.ArrayList;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Cell;


public class nToggleButton extends ToggleButton {

	public nToggleButton(String name, String label, ToggleButtonStyle style) {
		super(name, label, style);
	}
	
	public boolean touchDown(float x, float y, int pointer) {
		if (this.visible)
			return super.touchDown(x, y, pointer);
		else
		return false;
	}
	
	
	public boolean touchUp(float x, float y, int pointer) {
		if (this.visible)
			return super.touchUp(x, y, pointer);
		else
		return false;
	}
	
	ArrayList<Cell> cells = new ArrayList<Cell>();
	java.util.List<Actor> actors;
	float oldPrefWidth;
	float oldPrefHeight;
	public void Show(Boolean show) {
		if (show && !visible) {
			this.cells.addAll(cells);
			this.visible = true;
			prefWidth = oldPrefWidth;
			prefHeight = oldPrefHeight;
			if (this.parent instanceof Container) {
				Cell i =((Container) this.parent).layout.getCell(this);
				i.ignore = !i.ignore;
				
			}
		}
		else if (!show && visible) {
				cells = (ArrayList<Cell>) this.cells.clone();
				this.visible = false;
				
				this.cells.clear();
				oldPrefWidth = prefWidth;
				oldPrefHeight = prefHeight;
				prefWidth = 0;
				prefHeight = 0;
				if (this.parent instanceof Container) {
					Cell i =((Container) this.parent).layout.getCell(this);
					i.ignore = !i.ignore;
					
				}
		}
		
	}

}
